{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "20\n"
     ]
    }
   ],
   "source": [
    "def outer(a):\n",
    "    b=10\n",
    "    '''\n",
    "    a = 123,返回整体\n",
    "    a = abc,返回某列的值\n",
    "    '''\n",
    "    def inner():\n",
    "            nonlocal b\n",
    "            b = 20         \n",
    "            print(b)\n",
    "    def aabbcc():\n",
    "        nonlocal b\n",
    "        b = 20         \n",
    "        print(b)\n",
    "    if a == '123':\n",
    "        return inner()\n",
    "    elif a == 'abc':\n",
    "        return aabbcc()\n",
    "outer()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
